#include "RefBase.h"
#include "ZLog.h"

#ifdef WIN32
#include <Windows.h>
namespace detail
{
	int AtomicOps::Increment(int* i) 
	{
		return ::InterlockedIncrement(reinterpret_cast<LONG*>(i));
	}

	int AtomicOps::Decrement(int* i) 
	{
		return ::InterlockedDecrement(reinterpret_cast<LONG*>(i));
	}

}
#endif


#ifdef _DEBUG
int s_refCount = 0;
#endif

ZRefCountedBase::ZRefCountedBase()
{
#ifdef _DEBUG
    ++s_refCount;
#endif		
}

ZRefCountedBase::~ZRefCountedBase()
{
#ifdef _DEBUG
    if (--s_refCount == 0)
    {
        LOG(LS_INFO) << "All RefCounted object released";
    }
#endif
}
